
#include <stdio.h>
#include "Architecture.h"

bool init_aarch64() {
    RegisterSet* regs;

    regs = RegisterSet::makeFormattedRegSet("wreg", "w%d", 0, 31);
    regs->addRegName("wzr");
    Architecture::addRegSet(regs);
    regs = RegisterSet::makeFormattedRegSet("xreg", "x%d", 0, 31);
    regs->addRegName("xzr");
    Architecture::addRegSet(regs);
    
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("sreg", "s%d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("breg", "b%d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("dreg", "d%d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("qreg", "q%d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("hreg", "h%d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("hqreg", "hq%d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg", "v%d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("creg", "c%d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("sreg", "s%d", 0, 31));
    
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("sreg", "s%d", 0, 31));

    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.1q", "v%d.1q", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.1d", "v%d.1d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.2d", "v%d.2d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.2h", "v%d.2h", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.2s", "v%d.2s", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.4h", "v%d.4h", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.4s", "v%d.4s", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.8h", "v%d.8h", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.8b", "v%d.8b", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.16b", "v%d.16b", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.d", "v%d.d", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.s", "v%d.s", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.h", "v%d.h", 0, 31));
    Architecture::addRegSet(RegisterSet::makeFormattedRegSet("vreg.b", "v%d.b", 0, 31));

    RegisterSet* sysRegs = new RegisterSet("sysreg");
    char regName[100];
    for (int i = 0; i < 4; ++i) {
        for (int j = 0; j < 8; ++j) {
            for (int k = 0; k < 16; ++k) {
                for (int l = 0; l < 16; ++l) {
                    for (int m = 0; m < 8; ++m) {
                        snprintf(regName, 100, "s%d_%d_c%d_c%d_%d", i, j, k, l, m);
                        sysRegs->addRegName(regName);
                    }
                }
            }
        }
    }
    
    sysRegs->addRegName("scr_el3");
    sysRegs->addRegName("sctlr_el1");
    sysRegs->addRegName("sctlr_el2");
    sysRegs->addRegName("sctlr_el3");
    sysRegs->addRegName("sctlr_el3");
    sysRegs->addRegName("tcr_el1");
    sysRegs->addRegName("tcr_el2");
    sysRegs->addRegName("tcr_el3");
    sysRegs->addRegName("tpidr_el0");
    sysRegs->addRegName("tpidr_el1");
    sysRegs->addRegName("tpidr_el2");
    sysRegs->addRegName("tpidr_el3");
    sysRegs->addRegName("tpidrro_el0");
    sysRegs->addRegName("ttbr0_el1");
    sysRegs->addRegName("ttbr0_el2");
    sysRegs->addRegName("ttbr0_el3");
    sysRegs->addRegName("ttbr1_el1");
    sysRegs->addRegName("vbar_el1");
    sysRegs->addRegName("vbar_el2");
    sysRegs->addRegName("vbar_el3");
    sysRegs->addRegName("vmpidr_el2");
    sysRegs->addRegName("vpidr_el2");
    sysRegs->addRegName("vtcr_el2");
    sysRegs->addRegName("vttbr_el2");
    

    /* Debug system registers */
    
    sysRegs->addRegName("dbgauthstatus_el1");
    sysRegs->addRegName("dbgcr0_el1");
    sysRegs->addRegName("dbgcr1_el1");
    sysRegs->addRegName("dbgcr2_el1");
    sysRegs->addRegName("dbgcr3_el1");
    sysRegs->addRegName("dbgcr4_el1");
    sysRegs->addRegName("dbgcr5_el1");
    sysRegs->addRegName("dbgcr6_el1");
    sysRegs->addRegName("dbgcr7_el1");
    sysRegs->addRegName("dbgcr8_el1");
    sysRegs->addRegName("dbgcr9_el1");
    sysRegs->addRegName("dbgcr10_el1");
    sysRegs->addRegName("dbgcr11_el1");
    sysRegs->addRegName("dbgcr12_el1");
    sysRegs->addRegName("dbgcr13_el1");
    sysRegs->addRegName("dbgcr14_el1");
    sysRegs->addRegName("dbgcr15_el1");
    sysRegs->addRegName("dbgvr0_el1");
    sysRegs->addRegName("dbgvr1_el1");
    sysRegs->addRegName("dbgvr2_el1");
    sysRegs->addRegName("dbgvr3_el1");
    sysRegs->addRegName("dbgvr4_el1");
    sysRegs->addRegName("dbgvr5_el1");
    sysRegs->addRegName("dbgvr6_el1");
    sysRegs->addRegName("dbgvr7_el1");
    sysRegs->addRegName("dbgvr8_el1");
    sysRegs->addRegName("dbgvr9_el1");
    sysRegs->addRegName("dbgvr10_el1");
    sysRegs->addRegName("dbgvr11_el1");
    sysRegs->addRegName("dbgvr12_el1");
    sysRegs->addRegName("dbgvr13_el1");
    sysRegs->addRegName("dbgvr14_el1");
    sysRegs->addRegName("dbgvr15_el1");
    sysRegs->addRegName("dbgclaimclr_el1");
    sysRegs->addRegName("dbgclaimset_el1");
    sysRegs->addRegName("dbgdtr_el0");
    sysRegs->addRegName("dbgdtrrx_el0");
    sysRegs->addRegName("dbgdtrtx_el0");
    sysRegs->addRegName("dbgprcr_el1");
    sysRegs->addRegName("dbgvcr32_el2");
    sysRegs->addRegName("dbgwcr0_el1");
    sysRegs->addRegName("dbgwcr1_el1");
    sysRegs->addRegName("dbgwcr2_el1");
    sysRegs->addRegName("dbgwcr3_el1");
    sysRegs->addRegName("dbgwcr4_el1");
    sysRegs->addRegName("dbgwcr5_el1");
    sysRegs->addRegName("dbgwcr6_el1");
    sysRegs->addRegName("dbgwcr7_el1");
    sysRegs->addRegName("dbgwcr8_el1");
    sysRegs->addRegName("dbgwcr9_el1");
    sysRegs->addRegName("dbgwcr10_el1");
    sysRegs->addRegName("dbgwcr11_el1");
    sysRegs->addRegName("dbgwcr12_el1");
    sysRegs->addRegName("dbgwcr13_el1");
    sysRegs->addRegName("dbgwcr14_el1");
    sysRegs->addRegName("dbgwcr15_el1");
    sysRegs->addRegName("dbgwvr0_el1");
    sysRegs->addRegName("dbgwvr1_el1");
    sysRegs->addRegName("dbgwvr2_el1");
    sysRegs->addRegName("dbgwvr3_el1");
    sysRegs->addRegName("dbgwvr4_el1");
    sysRegs->addRegName("dbgwvr5_el1");
    sysRegs->addRegName("dbgwvr6_el1");
    sysRegs->addRegName("dbgwvr7_el1");
    sysRegs->addRegName("dbgwvr8_el1");
    sysRegs->addRegName("dbgwvr9_el1");
    sysRegs->addRegName("dbgwvr10_el1");
    sysRegs->addRegName("dbgwvr11_el1");
    sysRegs->addRegName("dbgwvr12_el1");
    sysRegs->addRegName("dbgwvr13_el1");
    sysRegs->addRegName("dbgwvr14_el1");
    sysRegs->addRegName("dbgwvr15_el1");
    sysRegs->addRegName("dlr_el0");
    sysRegs->addRegName("dspsr_el0");
    sysRegs->addRegName("mdccint_el1");
    sysRegs->addRegName("mdccsr_el0");
    sysRegs->addRegName("mdcr_el2");
    sysRegs->addRegName("mdcr_el3");
    sysRegs->addRegName("mdrar_el1");
    sysRegs->addRegName("mdscr_el1");
    sysRegs->addRegName("osdlr_el1");
    sysRegs->addRegName("osdtrrx_el1");
    sysRegs->addRegName("osdtrtx_el1");
    sysRegs->addRegName("oseccr_el1");
    sysRegs->addRegName("oslar_el1");
    sysRegs->addRegName("oslsr_el1");
    sysRegs->addRegName("sder32_el3");
    

    /* Performance monitoring system registers */
    
    sysRegs->addRegName("pmccfiltr_el0");
    sysRegs->addRegName("pmccntr_el0");
    sysRegs->addRegName("pmceid0_el0");
    sysRegs->addRegName("pmceid1_el0");
    sysRegs->addRegName("pmcntenclr_el0");
    sysRegs->addRegName("pmcntenset_el0");
    sysRegs->addRegName("pmcr_el0");
    sysRegs->addRegName("pmevcntr0_el0");
    sysRegs->addRegName("pmevcntr1_el0");
    sysRegs->addRegName("pmevcntr2_el0");
    sysRegs->addRegName("pmevcntr3_el0");
    sysRegs->addRegName("pmevcntr4_el0");
    sysRegs->addRegName("pmevcntr5_el0");
    sysRegs->addRegName("pmevcntr6_el0");
    sysRegs->addRegName("pmevcntr7_el0");
    sysRegs->addRegName("pmevcntr8_el0");
    sysRegs->addRegName("pmevcntr9_el0");
    sysRegs->addRegName("pmevcntr10_el0");
    sysRegs->addRegName("pmevcntr11_el0");
    sysRegs->addRegName("pmevcntr12_el0");
    sysRegs->addRegName("pmevcntr13_el0");
    sysRegs->addRegName("pmevcntr14_el0");
    sysRegs->addRegName("pmevcntr15_el0");
    sysRegs->addRegName("pmevcntr16_el0");
    sysRegs->addRegName("pmevcntr17_el0");
    sysRegs->addRegName("pmevcntr18_el0");
    sysRegs->addRegName("pmevcntr19_el0");
    sysRegs->addRegName("pmevcntr20_el0");
    sysRegs->addRegName("pmevcntr21_el0");
    sysRegs->addRegName("pmevcntr22_el0");
    sysRegs->addRegName("pmevcntr23_el0");
    sysRegs->addRegName("pmevcntr24_el0");
    sysRegs->addRegName("pmevcntr25_el0");
    sysRegs->addRegName("pmevcntr26_el0");
    sysRegs->addRegName("pmevcntr27_el0");
    sysRegs->addRegName("pmevcntr28_el0");
    sysRegs->addRegName("pmevcntr29_el0");
    sysRegs->addRegName("pmevcntr30_el0");
    sysRegs->addRegName("pmevtyper0_el0");
    sysRegs->addRegName("pmevtyper1_el0");
    sysRegs->addRegName("pmevtyper2_el0");
    sysRegs->addRegName("pmevtyper3_el0");
    sysRegs->addRegName("pmevtyper4_el0");
    sysRegs->addRegName("pmevtyper5_el0");
    sysRegs->addRegName("pmevtyper6_el0");
    sysRegs->addRegName("pmevtyper7_el0");
    sysRegs->addRegName("pmevtyper8_el0");
    sysRegs->addRegName("pmevtyper9_el0");
    sysRegs->addRegName("pmevtyper10_el0");
    sysRegs->addRegName("pmevtyper11_el0");
    sysRegs->addRegName("pmevtyper12_el0");
    sysRegs->addRegName("pmevtyper13_el0");
    sysRegs->addRegName("pmevtyper14_el0");
    sysRegs->addRegName("pmevtyper15_el0");
    sysRegs->addRegName("pmevtyper16_el0");
    sysRegs->addRegName("pmevtyper17_el0");
    sysRegs->addRegName("pmevtyper18_el0");
    sysRegs->addRegName("pmevtyper19_el0");
    sysRegs->addRegName("pmevtyper20_el0");
    sysRegs->addRegName("pmevtyper21_el0");
    sysRegs->addRegName("pmevtyper22_el0");
    sysRegs->addRegName("pmevtyper23_el0");
    sysRegs->addRegName("pmevtyper24_el0");
    sysRegs->addRegName("pmevtyper25_el0");
    sysRegs->addRegName("pmevtyper26_el0");
    sysRegs->addRegName("pmevtyper27_el0");
    sysRegs->addRegName("pmevtyper28_el0");
    sysRegs->addRegName("pmevtyper29_el0");
    sysRegs->addRegName("pmevtyper30_el0");
    sysRegs->addRegName("pmintenclr_el1");
    sysRegs->addRegName("pmintenset_el1");
    sysRegs->addRegName("pmovsclr_el1");
    sysRegs->addRegName("pmovsset_el1");
    sysRegs->addRegName("pmselr_el0");
    sysRegs->addRegName("pmswinc_el0");
    sysRegs->addRegName("pmuserenr_el0");
    sysRegs->addRegName("pmxevcntr_el0");
    sysRegs->addRegName("pmxevtyper_el0");


    /* Generic timer system registers */
    
    sysRegs->addRegName("cntfrq_el0");
    sysRegs->addRegName("cnthctl_el2");
    sysRegs->addRegName("cnthp_ctl_el2");
    sysRegs->addRegName("cnthp_cval_el2");
    sysRegs->addRegName("cnthp_cval_el2");
    sysRegs->addRegName("cntkctl_el1");
    sysRegs->addRegName("cntp_ctl_el0");
    sysRegs->addRegName("cntp_cval_el0");
    sysRegs->addRegName("cntp_tval_el0");
    sysRegs->addRegName("cntpct_el0");
    sysRegs->addRegName("cntps_ctl_el1");
    sysRegs->addRegName("cntps_cval_el1");
    sysRegs->addRegName("cntps_tval_el1");
    sysRegs->addRegName("cntv_ctl_el0");
    sysRegs->addRegName("cntv_cval_el0");
    sysRegs->addRegName("cntv_tval_el0");
    sysRegs->addRegName("cntvct_el0");
    sysRegs->addRegName("cntvoff_el2");
    

    /* Generic interrupt controller CPU interface system registers */
    
    sysRegs->addRegName("icc_ap0r0_el1");
    sysRegs->addRegName("icc_ap0r1_el1");
    sysRegs->addRegName("icc_ap0r2_el1");
    sysRegs->addRegName("icc_ap0r3_el1");
    sysRegs->addRegName("icc_ap1r0_el1");
    sysRegs->addRegName("icc_ap1r1_el1");
    sysRegs->addRegName("icc_ap1r2_el1");
    sysRegs->addRegName("icc_ap1r3_el1");
    sysRegs->addRegName("icc_asgi1r_el1");
    sysRegs->addRegName("icc_bpr0_el1");
    sysRegs->addRegName("icc_bpr1_el1");
    sysRegs->addRegName("icc_ctlr_el1");
    sysRegs->addRegName("icc_ctlr_el3");
    sysRegs->addRegName("icc_dir_el1");
    sysRegs->addRegName("icc_eoir0_el1");
    sysRegs->addRegName("icc_eoir1_el1");
    sysRegs->addRegName("icc_hppir0_el1");
    sysRegs->addRegName("icc_hppir1_el1");
    sysRegs->addRegName("icc_iar0_el1");
    sysRegs->addRegName("icc_iar1_el1");
    sysRegs->addRegName("icc_igrpen0_el1");
    sysRegs->addRegName("icc_igrpen1_el1");
    sysRegs->addRegName("icc_igrpen1_el3");
    sysRegs->addRegName("icc_pmr_el1");
    sysRegs->addRegName("icc_rpr_el1");
    sysRegs->addRegName("icc_rpr_el1");
    sysRegs->addRegName("icc_sgi0r_el1");
    sysRegs->addRegName("icc_sgi1r_el1");
    sysRegs->addRegName("icc_sre_el1");
    sysRegs->addRegName("icc_sre_el2");
    sysRegs->addRegName("icc_sre_el3");
    

    /* Generic interrupt controller virtual interface system registers */
    
    sysRegs->addRegName("ich_ap0r0_el2");
    sysRegs->addRegName("ich_ap0r1_el2");
    sysRegs->addRegName("ich_ap0r2_el2");
    sysRegs->addRegName("ich_ap0r3_el2");
    sysRegs->addRegName("ich_ap1r0_el2");
    sysRegs->addRegName("ich_ap1r1_el2");
    sysRegs->addRegName("ich_ap1r2_el2");
    sysRegs->addRegName("ich_ap1r3_el2");
    sysRegs->addRegName("ich_eisr_el2");
    sysRegs->addRegName("ich_elrsr_el2");
    sysRegs->addRegName("ich_hcr_el2");
    sysRegs->addRegName("ich_lr0_el2");
    sysRegs->addRegName("ich_lr1_el2");
    sysRegs->addRegName("ich_lr2_el2");
    sysRegs->addRegName("ich_lr3_el2");
    sysRegs->addRegName("ich_lr4_el2");
    sysRegs->addRegName("ich_lr5_el2");
    sysRegs->addRegName("ich_lr6_el2");
    sysRegs->addRegName("ich_lr7_el2");
    sysRegs->addRegName("ich_lr8_el2");
    sysRegs->addRegName("ich_lr9_el2");
    sysRegs->addRegName("ich_lr10_el2");
    sysRegs->addRegName("ich_lr11_el2");
    sysRegs->addRegName("ich_lr12_el2");
    sysRegs->addRegName("ich_lr13_el2");
    sysRegs->addRegName("ich_lr14_el2");
    sysRegs->addRegName("ich_lr15_el2");
    sysRegs->addRegName("ich_misr_el2");
    sysRegs->addRegName("ich_vmcr_el2");
    sysRegs->addRegName("ich_vtr_el2");

    /* Misc. System registers */
    sysRegs->addRegName("id_aa64mmfr0_el1");
    sysRegs->addRegName("trcacvr8");
    sysRegs->addRegName("id_aa64mmfr2_el1");
    sysRegs->addRegName("id_aa64mmfr1_el1");
    sysRegs->addRegName("amair_el1");
    sysRegs->addRegName("mvfr0_el1");
    sysRegs->addRegName("midr_el1");
    sysRegs->addRegName("mvfr1_el1");
    sysRegs->addRegName("trcdvcmr4");
    sysRegs->addRegName("trcdvcvr0");
    sysRegs->addRegName("trccntrldvr0");
    sysRegs->addRegName("trcdvcvr6");
    sysRegs->addRegName("trcdvcvr5");
    sysRegs->addRegName("trcacatr0");
    sysRegs->addRegName("trcacatr12");
    sysRegs->addRegName("trcacatr10");
    sysRegs->addRegName("trcacatr9");
    sysRegs->addRegName("trccidcvr0");
    sysRegs->addRegName("trcacvr4");
    sysRegs->addRegName("trcacvr2");
    sysRegs->addRegName("trcacvr1");
    sysRegs->addRegName("trcrsctlr16");
    sysRegs->addRegName("trcvmidcvr4");
    sysRegs->addRegName("trcvmidcvr2");
    sysRegs->addRegName("trcvmidcvr1");
    sysRegs->addRegName("trcacvr14");
    sysRegs->addRegName("trcacvr13");
    sysRegs->addRegName("trcacvr11");
    sysRegs->addRegName("trcdvcvr4");
    sysRegs->addRegName("trcacatr8");
    sysRegs->addRegName("trcacvr0");
    sysRegs->addRegName("trctraceidr");
    sysRegs->addRegName("trcvmidcvr0");
    sysRegs->addRegName("trcacvr12");
    sysRegs->addRegName("trcacvr10");
    sysRegs->addRegName("trcacvr9");
    sysRegs->addRegName("amair_el3");
    sysRegs->addRegName("mvfr2_el1");
    sysRegs->addRegName("amair_el2");
    sysRegs->addRegName("mair_el1");
    sysRegs->addRegName("trcdvcmr2");
    sysRegs->addRegName("trcdvcmr0");
    sysRegs->addRegName("trcimspec0");
    sysRegs->addRegName("trcdvcmr6");
    sysRegs->addRegName("trcdvcmr5");
    sysRegs->addRegName("trcdvcmr1");
    sysRegs->addRegName("trcseqevr0");
    sysRegs->addRegName("trcdvcvr1");
    sysRegs->addRegName("trcqctlr");
    sysRegs->addRegName("trcimspec4");
    sysRegs->addRegName("trcdvcmr6");
    sysRegs->addRegName("trcdvcmr5");
    sysRegs->addRegName("trcdvcmr1");
    sysRegs->addRegName("trcseqevr0");
    sysRegs->addRegName("trcdvcvr1");
    sysRegs->addRegName("trcqctlr");
    sysRegs->addRegName("trcimspec4");
    sysRegs->addRegName("trcimspec2");
    sysRegs->addRegName("trcimspec1");
    sysRegs->addRegName("trcextinselr");
    sysRegs->addRegName("trcseqevr2");
    sysRegs->addRegName("trcseqevr1");
    sysRegs->addRegName("dbgbvr0_el1");
    sysRegs->addRegName("trccntvr2");
    sysRegs->addRegName("trccntvr1");
    sysRegs->addRegName("dbgbcr8_el1");
    sysRegs->addRegName("trccntctlr2");
    sysRegs->addRegName("trccntctlr1");
    sysRegs->addRegName("dbgbcr4_el1");
    sysRegs->addRegName("trccntrldvr3");
    sysRegs->addRegName("dbgbcr2_el1");
    sysRegs->addRegName("dbgbcr1_el1");
    sysRegs->addRegName("trccntvr0");
    sysRegs->addRegName("trccntctlr0");
    sysRegs->addRegName("trccntrldvr2");
    sysRegs->addRegName("trccntrldvr1");
    sysRegs->addRegName("dbgbcr0_el1");
    sysRegs->addRegName("trcdvcmr7");
    sysRegs->addRegName("trcdvcvr7");
    sysRegs->addRegName("trcdvcvr3");
    sysRegs->addRegName("trcssccr0");
    sysRegs->addRegName("trcvdctlr");
    sysRegs->addRegName("trcvissctlr");
    sysRegs->addRegName("trcvmidcctlr0");
    sysRegs->addRegName("trcacatr6");
    sysRegs->addRegName("trcacatr5");
    sysRegs->addRegName("trcacatr3");
    sysRegs->addRegName("trcvictlr");
    sysRegs->addRegName("trccidcctlr0");
    sysRegs->addRegName("trcacatr4");
    sysRegs->addRegName("trcacatr2");
    sysRegs->addRegName("trcacatr1");
    sysRegs->addRegName("trcacatr13");
    sysRegs->addRegName("trcacatr14");
    sysRegs->addRegName("trcacatr11");
    sysRegs->addRegName("trcacatr15");
    sysRegs->addRegName("trccidcvr6");
    sysRegs->addRegName("trccidcvr5");
    sysRegs->addRegName("trccidcvr3");
    sysRegs->addRegName("trccidcvr4");
    sysRegs->addRegName("trccidcvr2");
    sysRegs->addRegName("trccidcvr1");
    sysRegs->addRegName("trcrsctlr8");
    sysRegs->addRegName("trcdvcvr2");
    sysRegs->addRegName("trceventctl0r");
    sysRegs->addRegName("trcacvr5");
    sysRegs->addRegName("trcacvr6");
    sysRegs->addRegName("trcrsctlr4");
    sysRegs->addRegName("trcauxctlr");
    sysRegs->addRegName("trcconfigr");
    sysRegs->addRegName("trcacvr3");
    sysRegs->addRegName("trcprocselr");
    sysRegs->addRegName("trcsspcicr4");
    sysRegs->addRegName("trcsspcicr2");
    sysRegs->addRegName("trcsspcicr1");
    sysRegs->addRegName("trcrsctlr28");
    sysRegs->addRegName("trcrsctlr26");
    sysRegs->addRegName("trcrsctlr25");
    sysRegs->addRegName("trcrsctlr22");
    sysRegs->addRegName("trcrsctlr21");
    sysRegs->addRegName("trcrsctlr19");
    sysRegs->addRegName("trcsspcicr0");
    sysRegs->addRegName("trcrsctlr24");
    sysRegs->addRegName("trcrsctlr20");
    sysRegs->addRegName("trcrsctlr18");
    sysRegs->addRegName("trcrsctlr17");
    sysRegs->addRegName("clidr_el1");
    sysRegs->addRegName("trcvmidcvr7");
    sysRegs->addRegName("trcrsctlr2");
    sysRegs->addRegName("trcacvr7");
    sysRegs->addRegName("trcvmidcvr6");
    sysRegs->addRegName("trcacvr15");
    sysRegs->addRegName("trcvmidcvr5");
    sysRegs->addRegName("trcvmidcvr3");
    sysRegs->addRegName("rvbar_el2");
    sysRegs->addRegName("mair_el3");
    sysRegs->addRegName("mair_el2");
    sysRegs->addRegName("id_pfr0_el1");
    sysRegs->addRegName("id_isar0_el1");
    sysRegs->addRegName("id_aa64pfr0_el1");
    sysRegs->addRegName("id_aa64dfr0_el1");
    sysRegs->addRegName("id_aa64isar0_el1");
    sysRegs->addRegName("aidr_el1");
    sysRegs->addRegName("trcdvcmr3");
    sysRegs->addRegName("trcimspec3");
    sysRegs->addRegName("dbgbvr8_el1");
    sysRegs->addRegName("dbgbvr2_el1");
    sysRegs->addRegName("dbgbvr1_el1");
    sysRegs->addRegName("trcoslar");
    sysRegs->addRegName("trcprgctlr");
    sysRegs->addRegName("trcimspec7");
    sysRegs->addRegName("trcimspec6");
    sysRegs->addRegName("trcimspec5");
    sysRegs->addRegName("dbgbvr6_el1");
    sysRegs->addRegName("trcseqrstevr");
    sysRegs->addRegName("dbgbvr12_el1");
    sysRegs->addRegName("dbgbvr10_el1");
    sysRegs->addRegName("dbgbvr9_el1");
    sysRegs->addRegName("dbgbvr5_el1");
    sysRegs->addRegName("dbgbvr3_el1");
    sysRegs->addRegName("dbgbvr4_el1");
    sysRegs->addRegName("dbgbcr10_el1");
    sysRegs->addRegName("trccntvr3");
    sysRegs->addRegName("dbgbcr9_el1");
    sysRegs->addRegName("dbgbcr12_el1");
    sysRegs->addRegName("dbgbcr11_el1");
    sysRegs->addRegName("dbgbcr6_el1");
    sysRegs->addRegName("trccntctlr3");
    sysRegs->addRegName("dbgbcr7_el1");
    sysRegs->addRegName("dbgbcr5_el1");
    sysRegs->addRegName("dbgbcr3_el1");
    sysRegs->addRegName("id_isar5_el1");
    sysRegs->addRegName("id_mmfr1_el1");
    sysRegs->addRegName("mpidr_el1");
    sysRegs->addRegName("trcsscsr4");
    sysRegs->addRegName("trcsscsr2");
    sysRegs->addRegName("trcssccr6");
    sysRegs->addRegName("trcsscsr0");
    sysRegs->addRegName("trcssccr4");
    sysRegs->addRegName("trcssccr2");
    sysRegs->addRegName("trcssccr1");
    sysRegs->addRegName("trceventctl1r");
    sysRegs->addRegName("trcsscsr1");
    sysRegs->addRegName("trcviiectlr");
    sysRegs->addRegName("trcvdarcctlr");
    sysRegs->addRegName("trcvdsacctlr");
    sysRegs->addRegName("trcssccr3");
    sysRegs->addRegName("trcvipcssctlr");
    sysRegs->addRegName("trcvmidcctlr1");
    sysRegs->addRegName("trccidcctlr1");
    sysRegs->addRegName("trcacatr7");
    sysRegs->addRegName("trctsctlr");
    sysRegs->addRegName("trcrsctlr12");
    sysRegs->addRegName("trcrsctlr10");
    sysRegs->addRegName("trcrsctlr6");
    sysRegs->addRegName("trccidcvr7");
    sysRegs->addRegName("trcrsctlr14");
    sysRegs->addRegName("trcrsctlr13");
    sysRegs->addRegName("trcrsctlr11");
    sysRegs->addRegName("trcrsctlr9");
    sysRegs->addRegName("trcsyncpr");
    sysRegs->addRegName("trcccctlr");
    sysRegs->addRegName("trcssccr5");
    sysRegs->addRegName("trcrsctlr7");
    sysRegs->addRegName("trcpdcr");
    sysRegs->addRegName("trcrsctlr5");
    sysRegs->addRegName("trcsspcicr7");
    sysRegs->addRegName("trcsspcicr5");
    sysRegs->addRegName("trcrsctlr29");
    sysRegs->addRegName("trcrsctlr30");
    sysRegs->addRegName("trcrsctlr27");
    sysRegs->addRegName("trcrsctlr31");
    sysRegs->addRegName("trcsspcicr6");
    sysRegs->addRegName("trcrsctlr23");
    sysRegs->addRegName("trcsspcicr3");
    sysRegs->addRegName("trcrsctlr3");
    sysRegs->addRegName("id_aa64dfr1_el1");
    sysRegs->addRegName("id_isar1_el1");
    sysRegs->addRegName("cnthp_tval_el2");
    sysRegs->addRegName("id_dfr0_el1");
    sysRegs->addRegName("id_isar2_el1");
    sysRegs->addRegName("id_pfr1_el1");
    sysRegs->addRegName("far_el1");
    sysRegs->addRegName("spsr_el1");
    sysRegs->addRegName("far_el2");
    sysRegs->addRegName("spsel");
    sysRegs->addRegName("currentel");
    sysRegs->addRegName("esr_el1");
    sysRegs->addRegName("sp_el0");
    sysRegs->addRegName("afsr0_el1");
    sysRegs->addRegName("sp_el1");
    sysRegs->addRegName("spsr_el2");
    sysRegs->addRegName("elr_el2");
    sysRegs->addRegName("spsr_el3");
    sysRegs->addRegName("elr_el1");
    sysRegs->addRegName("teecr32_el1");
    sysRegs->addRegName("csselr_el1");
    sysRegs->addRegName("ccsidr_el1");
    sysRegs->addRegName("id_mmfr2_el1");
    sysRegs->addRegName("id_aa64afr0_el1");
    sysRegs->addRegName("id_afr0_el1");
    sysRegs->addRegName("id_mmfr0_el1");
    sysRegs->addRegName("id_isar4_el1");
    sysRegs->addRegName("id_isar3_el1");
    sysRegs->addRegName("id_aa64isar1_el1");
    sysRegs->addRegName("id_aa64pfr1_el1");
    sysRegs->addRegName("dbgbvr14_el1");
    sysRegs->addRegName("dbgbvr13_el1");
    sysRegs->addRegName("dbgbvr11_el1");
    sysRegs->addRegName("dbgbvr7_el1");
    sysRegs->addRegName("trcseqstr");
    sysRegs->addRegName("dbgbvr15_el1");
    sysRegs->addRegName("dbgbcr14_el1");
    sysRegs->addRegName("dbgbcr13_el1");
    sysRegs->addRegName("dbgbcr15_el1");
    sysRegs->addRegName("id_aa64afr1_el1");
    sysRegs->addRegName("trcsscsr5");
    sysRegs->addRegName("trcsscsr7");
    sysRegs->addRegName("trcsscsr6");
    sysRegs->addRegName("trcsscsr3");
    sysRegs->addRegName("trcssccr7");
    sysRegs->addRegName("trcbbctlr");
    sysRegs->addRegName("trcstallctlr");
    sysRegs->addRegName("trcrsctlr15");
    sysRegs->addRegName("ctr_el0");
    sysRegs->addRegName("id_mmfr3_el1");
    sysRegs->addRegName("hpfar_el2");
    sysRegs->addRegName("far_el3");
    sysRegs->addRegName("esr_el2");
    sysRegs->addRegName("afsr0_el2");
    sysRegs->addRegName("afsr1_el2");
    sysRegs->addRegName("afsr1_el1");
    sysRegs->addRegName("hcr_el2");
    sysRegs->addRegName("fpexc32_el2");
    sysRegs->addRegName("afsr0_el3");
    sysRegs->addRegName("spsr_irq");
    sysRegs->addRegName("sp_el2");
    sysRegs->addRegName("isr_el1");
    sysRegs->addRegName("elr_el3");
    sysRegs->addRegName("ifsr32_el2");
    sysRegs->addRegName("rvbar_el1");
    sysRegs->addRegName("teehbr32_el1");
    sysRegs->addRegName("revidr_el1");
    sysRegs->addRegName("dczid_el0");
    sysRegs->addRegName("rvbar_el3");
    sysRegs->addRegName("actlr_el2");
    sysRegs->addRegName("actlr_el1");
    sysRegs->addRegName("actlr_el3");
    sysRegs->addRegName("esr_el3");
    sysRegs->addRegName("afsr1_el3");
    sysRegs->addRegName("cptr_el2");
    sysRegs->addRegName("spsr_und");
    sysRegs->addRegName("spsr_abt");
    sysRegs->addRegName("spsr_fiq");
    sysRegs->addRegName("contextidr_el1");
    sysRegs->addRegName("hstr_el2");
    sysRegs->addRegName("cptr_el3");
    sysRegs->addRegName("hacr_el2");
    
    Architecture::addRegSet(sysRegs);
    return true;
}

Architecture* arch_aarch64 = new Architecture("aarch64", 4, &init_aarch64, NULL);
